﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace community_severvice_exchange
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
                   using (FileStream f = new FileStream("users.bin", FileMode.OpenOrCreate, FileAccess.ReadWrite))
                   {
                       try
                       {
                           BinaryFormatter bf = new BinaryFormatter();
                           bf.Serialize(f, new List<User>());
                       }
                       catch (Exception e) 
                       {
                           Console.WriteLine(e);
                       }
                   }
                using (FileStream f = new FileStream("skillsWithProvider.bin", FileMode.OpenOrCreate, FileAccess.ReadWrite))
                   {
                       try
                       {
                           BinaryFormatter bf = new BinaryFormatter();
                           bf.Serialize(f, new List<Skills>());
                       }
                       catch (Exception e) 
                       {
                           Console.WriteLine(e);
                       }
                   }

            
            */
            UserRegister ur = new UserRegister();     
                              int[] i = {1,2};
                                int[] x ={1};
                                int[] y = { 1,2,3};
      
                           //ur.deleteUser("yeDIN");
                           ur.addUser("A", "110", "Edouard", i);
                           //List<User> list_user = ur.loadUser();
                            User user=ur.getUser("A");
                            ur.addNeed(user,1);
                           
                            ur.addUser("B", "110", "Edouard", x);                             
                            user = ur.getUser("B");                                       
                            ur.addNeed(user,2);
                            ur.addUser("C", "110", "Edouard", y);   
                            //user = ur.getUser("B");
                            ur.getUser("C");
                            List<Skills> l=ur.match(user,2);
                           // ur.initSaveMatched(user);
                            ur.saveMatched(user,l[0]);
                           //List<Skills> l =ur.loadSkillWithProvider();
                                foreach (Skills skill in l)
                                   Console.WriteLine(skill.ToString());
                           //foreach (User u in list_user)
                           //    Console.WriteLine(u.ToString());
                           Console.ReadKey();  
        }
    }
}